package com.bjpowernode.aspect.exercise;
import com.bjpowernode.aspect.exercise.beans.*;
import java.lang.reflect.Proxy;
public class MyApp3 {
    public static void main(String[] args) throws InterruptedException {
        Teacher teacher = new Teacher();
        Worker worker = new Worker();
        //创建代理类框架对象
        JDKProxy proxy=new JDKProxy();
        //设置代理类准备代理的目标类
        proxy.setTarget(teacher);
        //准备代理IA的接口方法
        IA ia =(IA) Proxy.newProxyInstance(MyApp3.class.getClassLoader(), new Class[]{IA.class, IB.class}, proxy);
        //准备代理IB的接口方法
        IB ib =(IB) Proxy.newProxyInstance(MyApp3.class.getClassLoader(), new Class[]{IA.class, IB.class}, proxy);
        //执行代理
        ia.doing();
        ib.fun1();
    }
}
